# Author:Zhang Yu
# 守护线程
import threading
import time
class MyThread(threading.Thread):
    def __init__(self,n):
        super(MyThread,self).__init__()
        self.n = n

    def run(self):
        print("runing", self.n,threading.current_thread())
        time.sleep(2)
        print("done",self.n)

if __name__ == '__main__':
    start_time = time.time()
    for i in range(50):
        t1 = MyThread(i)
        t1.start()


    while threading.active_count() != 1:
        print(threading.active_count())
    else:
        print(" all done")
    end_time = time.time()
    print(threading.current_thread(),end_time-start_time)